package com.hunktimes.wholesale.vm

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.liveData
import com.hunktimes.wholesale.base.BaseViewModel
import com.hunktimes.wholesale.extension.launch
import com.hunktimes.wholesale.net.WholeSaleRepository

/**
 * Author: Delete
 * Date: 2020/8/14` 9:41
 * Description:
 *
 */
class CollectionVM : BaseViewModel() {

    private val tmp = liveData {
        launch({
            val resp = WholeSaleRepository.getCollections()
            val orders = resp.data
            orders?.let {
                emit(it)
            }
        })
    }
    val collectionResult = MutableLiveData<List<String>>()

    fun getCollections() {
        launch({
            val resp = WholeSaleRepository.getCollections()
            val orders = resp.data
            orders?.let {
                collectionResult.value = it
            }
        })
    }

}